<!--{template user/header}-->
<div style="height:30px;">&nbsp;</div>
<form method="post" autocomplete="off" name="submitform" id="submitform" action="{u site/rechargehandle}">
<table class="list-table" border="0" cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th colspan="4" class="lt-th" style="position:relative;">
				<strong>充值积分</strong>
			</th>
		</tr>
	</thead>
	<tbody>
		<tr class="lt-title">
			<th class="first" width="50">选择</th>
			<th width="150">名称</th>
			<th width="100">手续费</th>
			<th class="last">说明</th>
		</tr>
		<!--{loop $payment_list $payment}-->
		<tr>
			<td class="lt-td first">
				<input id="check-{$payment[id]}" type="radio" name="payment" class="payment" value="$payment[id]" {if $payment['id'] == $incharge['payment']} checked="checked"{/if} />
			</td>
			<td class="lt-td">
				{if $payment['logo'] != ''}
				<img for="check-{$payment[id]}" src="$payment[logo]" width="150" alt="{$payment[name]}" title="{$payment[name]}"/>
				{else}
				$payment[name]
				{/if}
			</td>
			<td class="lt-td">
				{if $payment['fee'] > 0}
				$payment[fee_format]
				{/if}
			</td>
			<td class="lt-td tl last">
				$payment[description]
			</td>
		</tr>
		<!--{/loop}-->
	</tbody>
	<tfoot>
		<tr>
			<td colspan="4" class="pages tr">
				金额：<input type="text" class="text" size="10" id="amount" name="amount" value="$incharge['money']" />，可兑换 <span id="score">$incharge['score']</span> 积分，
				<input type="submit" class="formbutton" id="user-submit" value="充值" />
				<input type="hidden" name="action" value="rechargehandle" />
				<input type="hidden" name="id" value="$incharge['id']" />
			</td>
		</tr>
	</tfoot>
</table>
</form>
<script type="text/javascript">
var ratio = parseInt("{$_FANWE['setting']['money_score_ratio']}");

jQuery(function($){
	$("#amount").keyup(function(){
		var amount = parseInt(this.value);
		if(amount <= 0 || isNaN(amount))
		{
			this.value = '';
			amount = 0;
		}
		
		$("#score").html(amount * ratio);
	}).blur(function(){
		var amount = parseInt(this.value);
		if(amount <= 0 || isNaN(amount))
		{
			this.value = '';
			amount = 0;
		}
		
		$("#score").html(amount * ratio);
	});
	
	$("#user-submit").click(function(){
		var amount = parseInt($("#amount").val());
		if(amount <= 0 || isNaN(amount))
		{
			$("#amount").val('').focus();
			$.showErr("请输入要充值的金额");
			return false;	
		}
		
		if($(".payment:checked").length == 0)
		{
			$.showErr("请选择支付方式");
			return false;
		}
	});
});
</script>
<!--{template user/footer}-->